import 'dart:io';
import 'package:flutter/material.dart';

import '../../theme/jr.dart';
import 'app_fonts.dart';

/*
* 文件用于项目组件间横向和纵向间的组件间距设置
* DFTextStyles.textBlack1_font16;
* DFTextStyles.textBlack1_font16(100);
* */

const String fontFamilyFallback = 'PingFang SC';
const String fontFamily = 'Poppins';

class JRTextStyles {
  static TextStyle get styleFont8W400 {
    return TextStyle(
        color: Colors.white,
        fontSize: AppFonts.font_sp8,
        fontFamily: fontFamily,
        fontWeight: getFontWeight(400));
  }

  static TextStyle get styleFont9W400 {
    return TextStyle(
        color: Colors.white,
        fontSize: 9,
        fontFamily: fontFamily,
        fontWeight: getFontWeight(400));
  }

  static TextStyle get styleFont10W400 {
    return TextStyle(
        color: Colors.white,
        fontSize: AppFonts.font_sp10,
        fontFamily: fontFamily,
        fontWeight: getFontWeight(400));
  }

  static TextStyle get styleFont10W500 {
    return TextStyle(
        color: Colors.white,
        fontSize: AppFonts.font_sp10,
        fontFamily: fontFamily,
        fontWeight: getFontWeight(500));
  }

  static TextStyle get styleFont10W600 {
    return TextStyle(
        color: Colors.white,
        fontSize: AppFonts.font_sp10,
        fontWeight: getFontWeight(600));
  }

  static TextStyle get styleFont11W400 {
    return TextStyle(
        color: Colors.white, fontSize: 11, fontWeight: getFontWeight(400));
  }

  static TextStyle get styleFont11W600 {
    return TextStyle(
        color: Colors.white,
        fontSize: 11,
        fontFamily: fontFamily,
        fontWeight: getFontWeight(600));
  }

  static TextStyle get styleFont12W400 {
    return TextStyle(
        color: Colors.white,
        fontSize: AppFonts.font_sp12,
        fontFamily: fontFamily,
        fontWeight: getFontWeight(400));
  }

  static TextStyle get styleFont12W500 {
    return TextStyle(
        color: Colors.white,
        fontSize: AppFonts.font_sp12,
        fontFamily: fontFamily,
        fontWeight: getFontWeight(500));
  }

  static TextStyle get styleFont12W600 {
    return TextStyle(
        color: Colors.white,
        fontSize: AppFonts.font_sp12,
        fontFamily: fontFamily,
        fontWeight: getFontWeight(600));
  }

  static TextStyle get styleFont12W700 {
    return TextStyle(
        color: Colors.white,
        fontSize: AppFonts.font_sp12,
        fontFamily: fontFamily,
        fontWeight: getFontWeight(700));
  }

  static TextStyle get styleFont12W800 {
    return TextStyle(
        color: Colors.white,
        fontSize: AppFonts.font_sp12,
        fontFamily: fontFamily,
        fontWeight: getFontWeight(800));
  }

  static TextStyle get styleFont13W400 {
    return TextStyle(
        color: Colors.white,
        fontSize: 13,
        fontFamily: fontFamily,
        fontWeight: getFontWeight(400));
  }

  static TextStyle get styleFont13W500 {
    return TextStyle(
        color: Colors.white,
        fontSize: 13,
        fontFamily: fontFamily,
        fontWeight: getFontWeight(500));
  }

  static TextStyle get styleFont13W600 {
    return TextStyle(
        color: Colors.white,
        fontSize: 13,
        fontFamily: fontFamily,
        fontWeight: getFontWeight(600));
  }

  static TextStyle get styleFont14W400 {
    return TextStyle(
        color: Colors.white,
        fontSize: AppFonts.font_sp14,
        fontFamily: fontFamily,
        fontWeight: getFontWeight(400));
  }

  static TextStyle get styleFont14W500 {
    return TextStyle(
        color: Colors.white,
        fontSize: AppFonts.font_sp14,
        fontFamily: fontFamily,
        fontWeight: getFontWeight(500));
  }

  static TextStyle get styleFont14W600 {
    return TextStyle(
        color: Colors.white,
        fontSize: AppFonts.font_sp14,
        fontFamily: fontFamily,
        fontWeight: getFontWeight(600));
  }

  static TextStyle get styleFont14W700 {
    return TextStyle(
        color: Colors.white,
        fontSize: AppFonts.font_sp14,
        fontFamily: fontFamily,
        fontWeight: getFontWeight(700));
  }

  static TextStyle get styleFont14W800 {
    return TextStyle(
        color: Colors.white,
        fontSize: AppFonts.font_sp14,
        fontFamily: fontFamily,
        fontWeight: getFontWeight(800));
  }

  static TextStyle get styleFont15W500 {
    return TextStyle(
        color: Colors.white,
        fontSize: 15,
        fontFamily: fontFamily,
        fontWeight: getFontWeight(500));
  }

  static TextStyle get styleFont15W600 {
    return TextStyle(
        color: Colors.white,
        fontSize: 15,
        fontFamily: fontFamily,
        fontWeight: getFontWeight(600));
  }

  static TextStyle get styleFont16W500 {
    return TextStyle(
        color: Colors.white,
        fontSize: AppFonts.font_sp16,
        fontFamily: fontFamily,
        fontWeight: getFontWeight(500));
  }

  static TextStyle get styleFont16W600 {
    return TextStyle(
        color: Colors.white,
        fontSize: AppFonts.font_sp16,
        fontFamily: fontFamily,
        fontWeight: getFontWeight(600));
  }

  static TextStyle get styleFont16W700 {
    return TextStyle(
        color: Colors.white,
        fontSize: AppFonts.font_sp16,
        fontFamily: fontFamily,
        fontWeight: getFontWeight(700));
  }

  static TextStyle get styleFont16W800 {
    return TextStyle(
        color: Colors.white,
        fontSize: AppFonts.font_sp16,
        fontFamily: fontFamily,
        fontWeight: getFontWeight(800));
  }

  static TextStyle get styleFont18W600 {
    return TextStyle(
        color: Colors.white,
        fontSize: AppFonts.font_sp18,
        fontFamily: fontFamily,
        fontWeight: getFontWeight(600));
  }

  static TextStyle get styleFont18W700 {
    return TextStyle(
        color: Colors.white,
        fontSize: AppFonts.font_sp18,
        fontFamily: fontFamily,
        fontWeight: getFontWeight(700));
  }

  static TextStyle get title => TextStyle(
      fontSize: 17,
      fontWeight: FontWeight.w600,
      color: JR.color.mainText,
      fontFamily: fontFamily);
  static TextStyle get subtitle => TextStyle(
      fontSize: 15,
      fontWeight: FontWeight.w600,
      color: JR.color.mainText,
      fontFamily: fontFamily);
  static TextStyle get subhead => TextStyle(
      fontSize: 17,
      fontWeight: FontWeight.w400,
      color: JR.color.mainText,
      fontFamily: fontFamily);
  static TextStyle get body1 => TextStyle(
      fontSize: 14,
      fontWeight: FontWeight.w400,
      color: JR.color.mainText,
      fontFamily: fontFamily);
  static TextStyle get body2 => TextStyle(
      fontSize: 13,
      fontWeight: FontWeight.w400,
      color: JR.color.secondaryText,
      fontFamily: fontFamily);
  static TextStyle get button => TextStyle(
      fontSize: 15,
      fontWeight: FontWeight.w600,
      color: JR.color.mainText,
      fontFamily: fontFamily);
  static TextStyle get caption => TextStyle(
      fontSize: 13,
      fontWeight: FontWeight.w400,
      color: JR.color.tipsText,
      fontFamily: fontFamily);
  static TextStyle get subCaption => TextStyle(
      fontSize: 11,
      fontWeight: FontWeight.w400,
      color: JR.color.tipsText,
      fontFamily: fontFamily);
  static TextStyle get trailing => TextStyle(
      fontSize: 15,
      fontWeight: FontWeight.w400,
      color: JR.color.tipsText,
      fontFamily: fontFamily);

  static FontWeight getFontWeight(int weight) {
    FontWeight tmpWeight = FontWeight.w100;

    switch (weight) {
      case 100:
        tmpWeight = FontWeight.w100;
        break;
      case 200:
        tmpWeight = FontWeight.w200;
        break;
      case 300:
        tmpWeight = FontWeight.w300;
        break;
      case 400:
        tmpWeight = FontWeight.w400;
        break;
      case 500:
        tmpWeight = FontWeight.w500;
        break;
      case 600:
        tmpWeight = FontWeight.w600;
        break;
      case 700:
        tmpWeight = FontWeight.w700;
        break;
      case 800:
        tmpWeight = FontWeight.w800;
        break;
      case 900:
        tmpWeight = FontWeight.w900;
        break;
      default:
        tmpWeight = FontWeight.normal;
        break;
    }
    return tmpWeight;
  }
}
